package com.project.frame.common.utils;

import org.apache.commons.lang3.StringUtils;

import java.nio.charset.StandardCharsets;
import java.util.UUID;

/**
 * desc
 *
 * @author lw007
 * @date 2021/12/27
 */
public class Md5Utils {
    /**
     * 初始化密码
     */
    public static final String INIT_PASSWORD = "123456";

    public static String md5(String s) {
        return replaceBars(UUID.nameUUIDFromBytes(s.getBytes(StandardCharsets.UTF_8)).toString());
    }
    public static String replaceBars(String s) {
        if (StringUtils.contains(s, "-")) {
            return StringUtils.replace(s, "-", "");
        }
        return s;
    }
}
